<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="content-language" content="de" />
		<meta http-equiv="content-type" content="text/html; charset=utf-8;" />
		<title>railadmin v{{$railadminversion}}</title>
		<script type="text/javascript">
			var djConfig = {
				isDebug:true,
				usePlainJson:true
			};
		</script>
		<script type="text/javascript" src="resources/dojo-release-1.0.2/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
		<script type="text/javascript" src="resources/ajaxBridge/ajaxBridge.js"></script>
		<script type="text/javascript" src="railadmin.js"></script>
		<script type="text/javascript">
			// some dojo imports
			dojo.require("dojo.parser");
			dojo.require("dojo.data.ItemFileReadStore");
			dojo.require("dijit.Dialog");
			dojo.require("dijit.form.Button");
			dojo.require("dijit.form.FilteringSelect");
			dojo.require("dijit.form.TextBox");
			dojo.require("dijit.form.ValidationTextBox");
			dojo.require("dijit.layout.ContentPane");
			dojo.require("dijit.layout.TabContainer");
			dojo.require("dijit.Toolbar");
			dojo.require("dijit.Tree");

			dojo.addOnLoad( init );

			// init some dojo and dijit stuff
			function init() {
				if( '{{$mysql.user}}' != '' ){
					mysql_databases();
					dijit.byId('mysql_db').setValue('{{$mysql.db}}');
					dijit.byId('mysql_db').setDisabled(false);
					dijit.byId('mysql_newdb').setDisabled(false);
					dijit.byId('addmysql_form_submit').setDisabled(false);
				}
				if( '{{$mysql.db}}' != '' ){
					refresh();
					dijit.byId('mainTabContainer').selectChild( dijit.byId('log') );
				}
			}
		</script>
		<link rel="stylesheet" type="text/css" href="resources/dojo-release-1.0.2/dijit/themes/tundra/tundra.css" media="all" />
		<link rel="stylesheet" type="text/css" href="resources/dojo-release-1.0.2/dojo/resources/dojo.css" media="all" />
		<link rel="stylesheet" type="text/css" href="railadmin.css" media="all" />
	</head>

	<body class="tundra">
		<p id="version">PHPrail_{{$railversion}}&nbsp;&nbsp;railadmin_{{$railadminversion}}</p>
		<p id="status">{{$status}}</p>

		<!-- ** menubar -->
		<p id="menu">
			<a class="menuButton login" href="javascript:dijit.byId('login').show();">Am RAIL anmelden</a>
			<a class="menuButton exit" href="index.php?logout">Verbindung trennen</a>
		</p>

		<div id="contentpane">
			<div id="mainTabContainer" dojoType="dijit.layout.TabContainer">
				<!-- ** log -->
				<div id="log" dojoType="dijit.layout.ContentPane" title="RAIL Logfile" disabled="true"></div>
				<!-- ** railtree -->
				<div id="railtree" dojoType="dijit.layout.ContentPane" title="RAIL Baumstruktur"></div>

				<!-- ** backup -->
				<div id="backup" dojoType="dijit.layout.ContentPane" title="Backup">
					<form id="backup_form" name="backup_form" method="POST" enctype="multipart/form-data">
						<h2>Sicherung</h2>
						<p>Mysqldump der aktuellen Datenbank erzeugen <button dojoType="dijit.form.Button" id="backup_download" onclick="location.href='mysqldump.php';" disabled="disabled">Download</button>.</p>
						<h2 class="hasPrevious">Wiederherstellung</h2>
						<p class="warning">Achtung, bei der Wiederherstellung gehen die bisherigen Daten verloren. Sichern sie vor diesem Schritt unbedingt die aktuellen Daten.</p>
						<label>SQL Datei zurücksichern: <input id="backup_upload" name="backup_upload" type="file" disabled="disabled" /> (Maximale Dateigröße: {{$max_upload_size}})</label>
					</form>
				</div>

				<!-- ** patches -->
				<div id="patches" dojoType="dijit.layout.ContentPane" title="Patches">
					{{foreach from=$patches item=patch}}
						<div class="patch">
							<p>Name: <b>{{$patch.name}}</b><br />
							Benötigt: RAIL Version: {{$patch.from}}<br />
							Beschreibung: --<br />
							Download: <a href="../patch/{{$patch.file}}" target="_blank">../patch/{{$patch.file}}</a><br />
							Größe: {{$patch.size}}</p>
							<input type="hidden" id="patch_{{$patch.name}}_require" value="{{$patch.from}}" />
							<button id="patch_{{$patch.name}}"
								dojoType=dijit.form.Button
								type="button"
								disabled="disabled"
								onclick="rail_patche_install('{{$patch.file}}');">
							installieren</button>
						</div>
					{{/foreach}}
				</div>

				<!-- ** connect -->
				<div id="connect" dojoType="dijit.layout.ContentPane" title="MySQL Server" selected="true">
					<form id="mysql_form" name="mysql_form" method="POST">
						<label>
							<span>Host</span>
							<input type="text" name="mysql_host" value="{{$mysql.host}}"
								id="mysql_host"
						        dojoType="dijit.form.ValidationTextBox"
						        trim="true"
						        regExp="[\w.-]+"
						        invalidMessage="Hostname oder IP ungültig."
						        style="width: 295px;" />
						</label>
						<label>
							<span>Benutzer</span>
							<input type="text" name="mysql_user" value="{{$mysql.user}}"
						        id="mysql_user"
						        dojoType="dijit.form.ValidationTextBox"
						        trim="true"
						        regExp="[\w]+"
						        invalidMessage="Ungültiger Benutzername."
						        style="width: 295px;" />
						</label>
						<label>
							<span>Passwort</span>
							<input type="password" name="mysql_passwd" value="{{$mysql.passwd}}"
						        dojoType="dijit.form.TextBox"
						        trim="false"
						        style="width: 293px;" />
						</label>
						<label>
							<span>Datenbank</span>
							<input dojoType="dijit.form.FilteringSelect"
						        id="mysql_db"
								name="mysql_db"
								autocomplete="true"
								disabled="true"
								style="width: 295px;" />
						</label>
						<button dojoType=dijit.form.Button type="button" onclick="rail_connect();">Verbinden</button>
					</form>
					<form id="addmysql_form" name="addmysql_form" method="POST">
						<label>
							<span>Neue RAIL Datenbank</span>
							<input type="text" name="mysql_newdb"
						        id="mysql_newdb"
						        dojoType="dijit.form.ValidationTextBox"
						        trim="true"
						        regExp="[\w]+"
						        invalidMessage="Ungültiger Datenbankname."
						        style="width: 295px;"
						        disabled="disabled" />
						</label>
						<button dojoType=dijit.form.Button id="addmysql_form_submit" type="button" onclick="rail_create();" disabled="disabled">Anlegen</button>
					</form>
				</div>
			</div>

			<!-- ** modules -->
			<div class="action">
				<h3>Installierte Module</h3>
				{{foreach from=$modules item=module}}
				<button dojoType="dijit.form.Button" id="module_{{$module.name}}"
					onclick="load_module('{{$module.name}}');"
					title="{{$module.summary}}"
					disabled="disabled">
			    	<img src="{{$module.icon}}" />&nbsp;{{$module.name}}
				</button>
				{{/foreach}}
			</div>
		</div>

		<p id="bottom">railadmin - Administrationswerkzeug für die RAIL tree Technologie<br />
		Dieses ist freie Software. Der railadmin steht unter <a href="http://www.gnu.de/gpl-ger.html" target="_blank">GNU General Public License (GPL)</a><br />
		Besuchen sie die offizielle <a href="http://www.open-rail.org" target="_blank">Projekt Webseite</a></p>


		<!-- ** Dialog login -->
		<div dojoType="dijit.Dialog" id="login" title="RAIL Benutzer anmelden" refreshOnShow="true">
			<form id="login_form" name="login_form" method="POST">
				<label>
					<span>Benutzer</span>
					<input type="text" name="user"
		                dojoType="dijit.form.ValidationTextBox"
		                trim="true"
		                regExp="[\w]+"
		                invalidMessage="Ungültiger Datenbankname."
		                style="width: 145px;" />
				</label>
				<label>
					<span>Passwort</span>
					<input type="password" name="passwd"
		                dojoType="dijit.form.TextBox"
		                trim="true"
		                style="width: 143px;" />
				</label>
				<button dojoType=dijit.form.Button type="button" onclick="rail_login();">Anmelden</button>
				</form>
		</div>

	</body>
</html>